
import * as CONSTANT from '../action/constant';

const defaultState = 0  // js 任何有效值

//执行 ; action {type:'increatment', data }
// 纯函数 
// 更新 => 返回新的state(被复制的 新的地址)
const reducer  = (state=defaultState,action)=>{
    switch (action.type) {
        case CONSTANT.INCREMENT:
            console.log('INCREMENT')
            return state + 1
        case CONSTANT.DECREMENT:
            return state - 1
        default:
           return state
    }
}

export default reducer